<!DOCTYPE html>
<html>
<head lang="{{ app()->getLocale() }}">
    <title>{{ config('app.name', 'Laravel') }}</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <meta name="keywords" content="{{ config('app.keywords','laravel') }}" />
    <meta name="description" content="{{ config('app.keywords','laravel') }}" />
    <meta name="renderer" content="webkit">
    <meta name="viewport"   content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
    <link rel="stylesheet" href="{{ asset('css/amazeui.min.css') }}"  media="all">
    <link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">
    <link rel="stylesheet" href="{{ asset('css/font-awesome.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ asset('css/xes.common.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ asset('css/xes.mall.css') }}">
    <script src="{{ asset('js/jquery.min.js') }}"> </script>
    <script src="{{ asset('js/xes.md5.min.js') }}"> </script>
    <script src="{{ asset('js/xes.weblog.event.min.js') }}"> </script>
    <style>
        .xue-mall-sidebar-fixed ul li .xue-mall-sidebar-iconfont {
            float: left;
            width: 100%;
            height: 30px;
            line-height: 30px;
        }
        .xue-mall-sidebar-fixed ul li .xue-mall-toolbar-text {
            float: left;
            width: 100%;
            height: 20px;
            line-height: 12px;
            font-size: 12px;
        }
        .xue-mall-topbar-dropdown-list{
            top: 30px;
        }
    </style>


    <!-- 让IE8/9支持媒体查询，从而兼容栅格   -->
    <!--[if lt IE 9]>
    <script src="{{ asset('js/html5.min.js') }}"></script>
    <script src="{{ asset('js/respond.min.js') }}"></script>
    <![endif]-->
</head>
<body>
<div class="header-adv-box">
</div>
<header class="xue-mall-header-topbar">
    <div class="container">
        <div class="xue-mall-topbar-meun">
            <ul class="fl">
                <li class="xue-mall-topbar-dropdown xue-mall-choose-location" id="xue-mall-choose-location">
                            <span class="xue-mall-topbar-text">
                                <em class="province-name" data-id="100"></em> 教学视频网欢迎您
                            </span>
                </li>
            </ul>
            <!--右侧列表开始-->
            <ul class="fr">
                <li>
                    <a href="/">已购买视频</a>
                </li>
                @guest
                <li class="xue-mall-login noLogin-show">
                    <a href="/login">登录</a>
                </li>
                <li class="noLogin-show">
                    <a href="/register">注册</a>
                </li>
                @else
                <li class="xue-mall-login noLogin-show">
                    你好，{{ Auth::user()->name }}
                    <a href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                        注销
                    </a>
                    <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                        {{ csrf_field() }}
                    </form>
                </li>
                @endguest
            </ul>
        </div>
    </div>
</header>
<div class="xue-mall-header-navigation">
    <div class="container">
        <div class="xue-mall-logo">
            <a href="/"><img src="https://res15.xesimg.com/www/img/logo.svg"></a>
        </div>
        <div class="xue-mall-nav-list">
            <ul>
                <li @if (!isset($cate_info)) class="xue-active-underline" @endif>
                    <a href="/">首页</a>
                </li>
                @foreach ($cate_list as $one_cate)
                <li @if (isset($cate_info) && $cate_info->cate_id == $one_cate->cate_id) class="xue-active-underline" @endif>
                    <a href="/list/{{ $one_cate->cate_id }}">{{ $one_cate->cate_name }}</a>
                </li>
                @endforeach
            </ul>
        </div>
        <!--搜索开始-->
        {{--<div class="xue-mall-header-search fr" id="xue-mall-header-search-box">
            <div class="xue-mall-search-box">
                <input type="text" name="search" class="xue-mall-search-input" id="xue-mall-search-input" data-xeslog-enter="enter" data-xeslog-params="key=xeslog-searchInput-www&click_id=1.4.4&target_id=1.4&api_id=1.4.0" value="">
                <span class="xue-mall-search-btn" id="xue-mall-search-btn" data-xeslog-params="key=xeslog-searchFangdajing-www&click_id=1.4.5&target_id=1.4&api_id=1.4.0"><i class="iconfont icon-fangdajing"></i></span>
                <!--热词开始-->
                <div class="xue-mall-hotWord-box">
                    <ul></ul>
                </div>
                <!--热词结束-->
            </div>
            <!--热门搜索列表开始-->
            <div class="xue-mall-hotSearch-list xue-mall-hotList-hiding" id="xue-mall-hotSearch-list">
                <ul>
                    <div class="xue-mall-search-info">
                        <span class="xue-mall-search-title">热门搜索</span>
                    </div>
                </ul>
            </div>
            <!--热门搜索列表结束-->
            <!--搜索历史列表开始-->
            <div class="xue-mall-historySearch-list xue-mall-historyList-hiding" id="xue-mall-historySearch-list">
                <ul>
                    <div class="xue-mall-search-delList">
                        <span class="xue-mall-search-title">搜索历史</span><a href="javascript:void(0)" class="xue-mall-delAllHistorySeach" data-xeslog-params="key=xeslog-headAndSidebar-www&click_id=1.8.12&target_id=''&api_id=1.2.0">全部删除</a>
                    </div>
                </ul>
            </div>
            <!--搜索历史列表结束-->
            <!-- 前缀词搜索列表开始 -->
            <div class="xue-mall-prefixesSearch-list xue-mall-prefixesList-hiding" id="xue-mall-prefixesSearch-list">
                <ul>
                </ul>
            </div>
            <!-- 前缀此搜索列表结束 -->
        </div>--}}
        <!--搜索结束-->
    </div>
</div>
<div id="xue-mall-sweep-box"></div>
<!--课程列表区域开始-->
@yield('content')
<!--课程列表区域结束-->
<footer class="xue-footer xue-mall-footer am-text-center">
    <p>
        <a target="_blank" href="https://www.xueersi.com">网校首页</a>
        <span class="am-footer-divider">|</span>
        <a target="_blank" href="https://www.xueersi.com/article/detail/1903">关于我们</a>
        <span class="am-footer-divider">|</span>
        <a target="_blank" href="http://job.100tal.com/xueersi">网校招聘</a>
        <span class="am-footer-divider">|</span>
        <a target="_blank" href="https://www.xueersi.com/article/detail/1220">合作专区</a>
        <span class="am-footer-divider">|</span>
        <a target="_blank" href="https://www.xueersi.com/article/detail/1538">联系我们</a>
        <span class="am-footer-divider">|</span>
        <a target="_blank" href="https://www.xueersi.com/StudentFeedback/apply/">意见反馈</a>
        <span class="am-footer-divider">|</span>
        <a target="_blank" href="http://src.100tal.com">漏洞提交</a>
        <span class="am-footer-divider">|</span>

        <a target="_blank" href="https://www.xueersi.com/article/detail/1495">版权声明</a>
        <span class="am-footer-divider">|</span>
        <a target="_blank" href="https://www.xueersi.com/article/detail/1944">反盗链声明</a>
    </p>
    <div class="am-footer-miscs ">
        <p>
            客服电话： <strong class="am-text-danger">400-800-2211</strong>
            （免长途话费） Copyright &copy; 2009-2018&nbsp;学而思网校 www.xueersi.com 北京学而思教育科技有限公司 版权所有
        </p>
        <p>
            地址：北京市海淀区中关村大街18号科贸中心7层  京ICP证080230号
            <a target="_blank" href="http://www.miitbeian.gov.cn">京ICP备09032638号</a>
            <a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11010802020171">
                <img src="https://res11.xesimg.com/public/img/jgwab.png" class="xue-footer-record-icon">
                京公网安备 11010802020171号
            </a>
        </p>
        <p class="link">
            <a target="_blank" href="https://search.szfw.org/cert/l/CX20120925001738002003" id="___szfw_logo___">
                <img class="xue-footer-Integrity-icon" src="https://res12.xesimg.com/public/img/13487953879693.png">
            </a>
        </p>
    </div>
</footer>
<script type="text/javascript" defer="defer" async="true/false" >
    var ma_min = document.createElement('script');
    ma_min.type = 'text/javascript';
    ma_min.src = ('https:' == document.location.protocol ? 'https://netlog.xesimg.com' : 'https://netlog.xesv5.com') + '/ma_min.js?1514549590'
    var ss = document.getElementsByTagName('script')[0];
    ss.parentNode.insertBefore(ma_min, ss);

</script>
<script type="text/javascript">
    var _maq = _maq || [];
    _maq.push(['_setAccount', 'v5_www.xueersi.com']);
    _maq.push(['_setBZ', 'pv']);
    (function () {
        var ma = document.createElement('script');
        ma.type = 'text/javascript';
        ma.async = true;
        ma.src = ('https:' == document.location.protocol ? 'https://netlog.xesimg.com' : 'https://netlog.xesv5.com') + '/ma.js?1514549590';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(ma, s);
    })();
</script>
<script src="{{ asset('js/entrance.js') }}" id="zhichiScript" data-args="manual=true" class="zhiCustomBtn"></script>
<script>
    $(function () {
        var $xueMallHotWords = $('.xue-mall-hotWord-box');
        var $hotWordsUl = $xueMallHotWords.children('ul');
        var $carouselInner = $('.carousel-inner');
        var $carouselIndicators = $('.carousel-indicators');
        var $footerAdvBox = $('.footer-adv-box');
        var $headerAdvBox = $('.header-adv-box');
        var $xueMallCourseList = $('.xue-mall-course-list');
        var $gradeItem = $('.grade-item');
        var $terItem = $('.ter-item');
        var $subIem = $('.sub-item');
        var $longLiveBox = $('.xue-sync-courses').children('ul');
        var $liveCourseBox = $('.live-course-box').children('ul');
        var indexPageUrl;
        var $noLoginShow = $('.noLogin-show');
        var $loginShow = $('.login-show');
        var $provinceName = $('.province-name');
        var $xueMallCourseList = $('.xue-mall-course-list');
        var $tongbuCourseBox = $('.tongbu-course-box');
        var $zhuantiCourseBox = $('.zhuanti-course-box');
        var $noticeWarp = $('.notice-warp');
        var $xueMallBannerMask = $('.xue-mall-banner-mask');
        var $more = $('.xue-mall-card-more');
        var $searchHistory = $('.xue-mall-historySearch-list');

        // 打点统计的数据
        var provinceId;
        var headeAdvert;
        var footAdvert = [];
        var indexAdvert = [];
        var curGrade;
        var gradeId; //年级
        var terId; //学期
        var subId; //学科
        var tbcourse = []; //同步课
        var ztcourse = []; //专题课
        var isIndexAdvert = false; //判断轮播图接口是否完成
        var isfootAdFn = false; //判断底部广告接口是否完成
        // 搜索历史记录
        // function searchHistory() {
        //     $.ajax({
        //         url: '/Index/searchHistorys',
        //         type: 'POST',
        //         dataType: 'json',
        //         success: function (res) {
        //             if (res.status === 1) {
        //                 $searchHistory.find('ul li').remove();
        //                 var data = res.data;
        //                 // console.log(data[0]);
        //                 data[0].forEach(function (value, index, array) {
        //                     if (index < 5) {
        //                         var dataLi = '<li><a href="https://www.xueersi.com/search?keyword=' + value + '" data-xeslog-params="key=xeslog-headAndSidebar-www&click_url=https://www.xueersi.com/search?keyword=' + value + '&click_id=1.8.11&target_id=&api_id=1.1.8&search_word=' + value + '">' + value + '</a></li>';
        //                     }
        //                     $searchHistory.find('.xue-mall-search-hostList').append(dataLi);
        //                 });
        //             }
        //         }
        //     });
        // }
        // $(function () {
        // 获取cookie,判断是否登陆
        function getCookie(name) {
            var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
            if (arr = document.cookie.match(reg))
                return unescape(arr[2]);
            else
                return;
        }
        function setCookie(name, value) {
            var Days = 1;
            var exp = new Date();
            exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
            document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/;domain=xueersi.com";
        }
        var ip = returnCitySN["cip"];
        // setCookie('ip', ip);
        // setCookie('UA', navigator.userAgent);
        if (!getCookie('ip')) {
            setCookie('ip', ip);
        }
        if (!getCookie('UA')) {
            setCookie('UA', navigator.userAgent);
        }
        if (!getCookie('time')) {
            setCookie('time', new Date().getTime());
        }
        if (Number(getCookie('is_login')) === Number(1)) {
            searchHistory()
            getExperienceClassInfo()
        }
        function Log_params(element,params){
            var logData = {
                'elem':element[0],
                'params':params
            }
            window.xesWeb_eventLog.xesEventLog('click',logData);
        }

        //一对一跳转链接
        $(".OneAddOne").on("click",function(){
            var url = "";
            var uGrade = getCookie('uGrade');//年级
            if (Number(getCookie('is_login')) === Number(1)) {

                if(uGrade < 8){

                    url ="https://www.dadaabc.com/go/9781"
                }else{
                    url ="https://fudao.dahai.com/wx/"
                }
            } else {
                uGrade = null;
                url = "https://fudao.dahai.com/wx/"
            }
            var params = "key=xeslog-headAndSidebar-www&click_url="+url+"&api_id=1.1.0&click_id=1.8.10&grade="+uGrade
            var _this = $(this).find("a")
            Log_params(_this,params)
            window.open(url);

        })

        // 体验课入口提示
        function getExperienceClassInfo() {
            var value = getCookie("is_exp_tip_click");
            $.ajax({
                // http://www.xueersi.com/Index/isHaveExpericeCourse
                url: "/Index/isHaveExpericeCourse",
                type: "POST",
                dataType: "json",
                success: function (response) {
                    var sta = 1;
                    if (response.status == 1) {
                        sta = response.data.isHaveExpericeCourse;
                        if (Number(sta) === Number(1)) {
                            if (value) {
                                $('#xue-learn-experienceclass-enter').hide();
                            } else {
                                $('#xue-learn-experienceclass-enter').show()
                            }
                        } else {
                            $('#xue-learn-experienceclass-enter').hide();
                        }
                    }
                }
            })
        }
        // 已经登陆下搜索历史记录
        function searchHistory() {
            $.ajax({
                url: '/Index/searchHistorys',
                type: 'POST',
                dataType: 'json',
                success: function (res) {
                    if (res.status === 1) {
                        $("#xue-mall-historySearch-list").find('ul li').remove();
                        var data = res.data[0];
                        var len=res.data[0].length;
                        data=len>5? data.slice(0,5):data;
                        var str="";
                        for (var n = 0; n < data.length; n++) {
                            str += '<li><a href="https://www.xueersi.com/search?keyword=' + data[n] + '" data-xeslog-params="key=xeslog-headAndSidebar-www&click_url=https://www.xueersi.com/search?keyword=' + data[n] + '&click_id=1.8.11&target_id=&api_id=1.1.8&search_word=' + data[n] + '">' + data[n] + '</a></li>'
                        }
                        $("#xue-mall-historySearch-list").find("ul").append(str);
                    }
                }
            });
        }
        // 热门搜索列表----
        gethotsearch()
        function gethotsearch() {
            $.ajax({
                // url: 'https://www.xueersi.com/Index/hotWords',
                url: '/Index/hotWords',
                type: "GET",
                dataType: 'json',
                success: function (resopnse) {
                    if (resopnse.status === 1) {
                        // $("#xue-mall-hotSearch-list").find('ul li').remove();
                        if (resopnse.data.searchHotWords) {
                            var total = resopnse.data.searchHotWords.length;
                            var data = resopnse.data.searchHotWords;
                            data = total > 5 ? data.slice(0, 5) : data;
                            var str = "";
                            var rank = 0;
                            for (var i = 0; i < data.length; i++) {
                                rank += 1;
                                str += '<li><a href="https://www.xueersi.com/search?keyword=' + data[i] + '" data-xeslog-params="key=xeslog-headAndSidebar-www&click_url=https://www.xueersi.com/search?keyword=' + data[i] + '&click_id=1.8.27&target_id=&api_id=1.1.8&search_word=' + data[i] + '"><span class="hotsearch-raking" >' + rank + '</span> <span class="hotsearch-content">' + data[i] + '</span></a></li>'
                            }
                            $("#xue-mall-hotSearch-list").find("ul").append(str);
                        }
                    }
                }
            });
        }
        // })
        //热词推荐
        function hotWordsFn() {
            $.ajax({
                url: '/Index/hotWords',
                type: 'POST',
                dataType: 'json',
                success: function (res) {
                    if (res.status === 1) {
                        $hotWordsUl.children('a').remove();
                        var data = res.data;
                        data.hotwords.forEach(function (value, index, array) {
                            if (index < 3) {
                                var dataLi = "<li><a href='https://www.xueersi.com/search?keyword=" + value + "&category=1005' data-xeslog-params='key=xeslog-headAndSidebar-www&click_url= https://www.xueersi.com/search?keyword=" + value + "&category=1005&click_id=1.1.29&target_id=&api_id=" + res.data.api_id + "&hot_word=" + value + "'>" + value + "</a></li>";
                            }
                            $hotWordsUl.append(dataLi);
                        });
                    } else {

                    }
                }
            });
        }

        //轮播图
        var carouseFnAjax1 = null;
        var carouseFnAjax2 = null;
        function carouseFn(userGrade,userId) {
            if(carouseFnAjax1) {carouseFnAjax1.abort();}
            userGrade = userGrade ? userGrade : '';
            var data={
                adslot_id:2,
                user_id:parseInt(userId),
                info:{
                    grade:parseInt(userGrade)
                }
            }

            carouseFnAjax1 = $.ajax({
                url: '//ads.xueersi.com/v1/search',
                type: 'POST',
                dataType: 'json',
                data: JSON.stringify(data),
                success: function (res) {
                    if(res.code === 0){
                        $('#xue-mall-sweep-box').empty();
                        var indexAdvertData = res.data.adverts;
                        var dataLi = '';
                        var active = "";

                        dataLi += "<div id='xue-mall-banner-box' class='carousel slide xue-mall-banner-box' data-ride='carousel'>";
                        dataLi += "<ul class='carousel-inner focus-list' role='listbox'>";

                        indexAdvertData.forEach(function (value, index, array) {
                            var Advert_info={
                                dnf:res.data.dnf,
                                extra:res.data.extra,
                                order:value.order,
                                ad_id:value.id,
                                material_id:parseInt(value.content.id),
                                grade_id:res.data.dnf.grade
                            }
                            var params = 'key=xeslog-CourseIndex-www&click_id=1.1.16&log_from=advert&device_id='+getCookie('ip')+'&client_type=pc&event_name=click&advert_info='+JSON.stringify(Advert_info).replace(/\s/g,"&nbsp;")

                            if (index === 0) {
                                active = "active"
                            } else {
                                active = ""
                            }
                            dataLi += "<li class='item "+active+"'><a target='_blank' data-xeslog-params='"+params+"' href='" + value.content.url + "' style='background: url(" + value.content.img_url + ")' title='" + value.content.title + "'></a></li>";
                        });
                        dataLi += "</ul>";
                        dataLi += "<div class='focus-num-wrap'>";
                        dataLi += "<ol class='carousel-indicators focus-num'>";
                        indexAdvertData.forEach(function (value, index, array) {

                            if (index === 0) {
                                active = "active"
                            } else {
                                active = ""
                            }
                            dataLi += "<li class='"+active+"' data-target='#xue-mall-banner-box' data-slide-to=" + index + "><a href='javascript:void(0)'>" + value.content.title + "</a></li>";
                            indexAdvert.push(value.id);
                        });
                        dataLi += "</ol>";
                        dataLi += "</div>";
                        dataLi += " <div id='xue-mall-banner-mask' class='xue-mall-banner-mask' style='display:none;'></div>"
                        dataLi += "</div>"
                        $('#xue-mall-sweep-box').append(dataLi);
                        $('.carousel').carousel()
                        /**banner广告位第一次曝光日志**/
                        var $lis = $('#xue-mall-sweep-box').find('.item').eq(0),
                            $lia = $lis.find("a"),
                            _params = $lia.attr("data-xeslog-params");
                        _params = _params.replace("event_name=click","event_name=exposure");
                        Log_params($lia,_params)
                        $('#xue-mall-sweep-box').off('slid.bs.carousel').on('slid.bs.carousel', function (event) {
                            /**banner广告位曝光日志**/
                            var $hoder = $('#xue-mall-sweep-box').find('.item'),
                                $items = $(event.relatedTarget),
                                getIndex= $hoder.index($items),
                                _this = $items.find("a"),
                                params =  _this.attr("data-xeslog-params");
                            params = params.replace("event_name=click","event_name=exposure");
                            Log_params(_this,params)
                        })
                    }
                }
            });
            var datas={
                adslot_id:4,
                user_id:parseInt(userId),
                info:{
                    grade:parseInt(userGrade)
                }
            }
            if(carouseFnAjax2) {carouseFnAjax2.abort();}
            carouseFnAjax2 = $.ajax({
                url: '//ads.xueersi.com/v1/search',
                type: 'POST',
                dataType: 'json',
                data: JSON.stringify(datas),
                success: function (res) {
                    if(res.code == 0){
                        var $xueMallBannerMask=$("#xue-mall-banner-mask");
                        var maskAdvertData = res.data.adverts;
                        if (!getCookie('xes_mask_type') && maskAdvertData.length > 0) {
                            $xueMallBannerMask.show();
                            maskAdvertData.forEach(function (value, index, array) {
                                var Advert_info={
                                    dnf:res.data.dnf,
                                    extra:res.data.extra,
                                    order:value.order,
                                    ad_id:value.id,
                                    material_id:parseInt(value.content.id),
                                    grade_id:res.data.dnf.grade
                                }
                                var params = 'key=xeslog-CourseIndex-www&click_id=1.1.99&log_from=advert&device_id='+getCookie('ip')+'&client_type=pc&event_name=click&advert_info='+JSON.stringify(Advert_info).replace(/\s/g,"&nbsp;")
                                var maskAdvertLi="<div class='xue-mall-banner-advertise-closeBtn-box' >"+
                                    "<a href='"+value.content.url+"' data-xeslog-params='"+params+"'  class='xue-mall-banner-mask-inner' ><img src='"+value.content.img_url+"'></a>"+
                                    "<i class='xue-mall-banner-advertise-closeBtn' id='xue-mall-banner-advertise-closeBtn'></i></div>"

                                // var maskAdvertLi = "<a href=" +"'" "' class='xue-mall-banner-mask-inner' style='background: url(" + value.img_url + ")'><i class='xue-mall-banner-advertise-closeBtn'></i></a>";
                                $xueMallBannerMask.append(maskAdvertLi);
                                var _this = $xueMallBannerMask.find("a"),
                                    _params = _this.attr("data-xeslog-params");
                                _params = _params.replace("event_name=click","event_name=exposure");
                                Log_params(_this,_params)
                            });
                        } else {
                            $xueMallBannerMask.hide();
                        }
                    }
                }
            })


        }
        //底部广告
        var footAdFnAjax2 = null;
        function footAdFn(userGrade,userId) {
            if(footAdFnAjax2) {footAdFnAjax2.abort();}

            userGrade = userGrade ? userGrade : '';
            var data={
                adslot_id:5,
                user_id:parseInt(userId),
                info:{
                    grade:parseInt(userGrade)
                }
            }
            footAdFnAjax2 = $.ajax({
                url: '//ads.xueersi.com/v1/search',
                type: 'post',
                dataType: 'json',
                data: JSON.stringify(data),
                success: function(res) {
                    if(res.code === 0){
                        $footerAdvBox.children('a').remove();
                        var Advert_info={
                            dnf:res.data.dnf,
                            extra:res.data.extra,
                            order:res.data.adverts[0].order,
                            ad_id:res.data.adverts[0].id,
                            material_id:parseInt(res.data.adverts[0].content.id),
                            grade_id:res.data.dnf.grade
                        }
                        var params = 'key=xeslog-CourseIndex-www&click_id=1.1.28&log_from=advert&device_id='+getCookie('ip')+'&client_type=pc&event_name=click&advert_info='+JSON.stringify(Advert_info).replace(/\s/g,"&nbsp;")
                        var footData = '<a href='+JSON.stringify(res.data.adverts[0].content.url)+'><img src=' + JSON.stringify(res.data.adverts[0].content.img_url) + " alt='"+JSON.stringify(res.data.adverts[0].content.title)+"' usemap='#Map' border='0'></a>";
                        $footerAdvBox.append(footData);
                        $footerAdvBox.find("a").attr("data-xeslog-params",params)
                        var _this = $footerAdvBox.find("a"),
                            _params = params.replace("event_name=click","event_name=exposure");
                        Log_params(_this,_params)
                    }
                },
                error: function(err) {

                }
            })

        }
        //tab类筛选
        var tabFnAjax = null;
        function tabAjax(urlParam, userGrade, prvId) {
            urlParam = urlParam ? urlParam : '';
            if(tabFnAjax){tabFnAjax.abort();}
            tabFnAjax = $.ajax({
                url: '/Index/courseSifts',
                type: 'POST',
                dataType: 'json',
                data: {
                    indexPageUrl: urlParam,
                    xes_new_prv_id: prvId,
                    userGrade: userGrade
                },
                success: function (res) {
                    if (res.status === 1) {
                        // 高三年级同步课程显示
                        if(userGrade==13){
                            $('.am-grade-three').css('display','block').siblings('ol').css('display','none')
                        }else{
                            $('.am-grade-three').css('display','none').siblings('ol').css('display','block')
                        }
                        var gradeData = res.data.list;
                        gradeId = res.data.grade;//当前选中年级
                        terId = res.data.ter;//当前选中学期
                        subId = res.data.sub;//当前选中学科
                        setCookie('userGrade', gradeId);

                        $gradeItem.children('a').remove();
                        $terItem.children('a').remove();
                        $subIem.children('a').remove();
                        gradeData.forEach(function (value, index, array) {
                            if (value.check === 'active') {
                                var gradeLi = "<a class='active' data-xeslog-params='key=xeslog-courseIndex-www&api_id=" + res.data.api_id + "&click_url=" + value.url + "&grade_name=" + value.name + "&click_id=1.1.17&grade_id=" + value.id + "&target_id=1.1' href='javascript:;' data-url=" + value.urlParam + " data-id=" + value.id + " >" + value.name + "</a>";
                                var terData = value.list;
                                terData.forEach(function (value, index, array) {
                                    if (value.check === 'active') {
                                        var terLi = "<a class='active' data-xeslog-params='key=xeslog-courseIndex-www&api_id=" + res.data.api_id + "&click_url=" + value.url + "&term_name=" + value.name + "&click_id=1.1.18&term_id=1&target_id=1.1' href='javascript:;' data-url=" + value.urlParam + " data-id=" + res.data.grade + " >" + value.name + "</a>";
                                        var subData = value.list;
                                        subData.forEach(function (value, index, array) {
                                            if (value.check === 'active') {
                                                var subLi = "<a class='active' data-xeslog-params='key=xeslog-courseIndex-www&api_id=" + res.data.api_id + "&click_url=" + value.url + "&subject_name=" + value.name + "&click_id=1.1.19&subject_id=" + value.id + "&target_id=1.1' href='javascript:;' data-url=" + value.urlParam + " data-id=" + value.id + " >" + value.name + "</a>";
                                            } else {
                                                var subLi = "<a data-xeslog-params='key=xeslog-courseIndex-www&api_id=" + res.data.api_id + "&click_url=" + value.url + "&subject_name=" + value.name + "&click_id=1.1.19&subject_id=" + value.id + "&target_id=1.1' href='javascript:;' data-url=" + value.urlParam + " data-id=" + value.id + " >" + value.name + "</a>";
                                            }
                                            $subIem.append(subLi);
                                        });
                                    } else {
                                        var terLi = "<a data-xeslog-params='key=xeslog-courseIndex-www&api_id=" + res.data.api_id + "&click_url=" + value.url + "&term_name=" + value.name + "&click_id=1.1.18&term_id=" + value.id + "&target_id=1.1' href='javascript:;' data-url=" + value.urlParam + " data-id=" + res.data.grade + " >" + value.name + "</a>";
                                    }
                                    $terItem.append(terLi);
                                });
                            } else {
                                var gradeLi = "<a data-xeslog-params='key=xeslog-courseIndex-www&api_id=" + res.data.api_id + "&click_url=" + value.url + "&grade_name=" + value.name + "&click_id=1.1.17&grade_id=" + value.id + "&target_id=1.1' href='javascript:;' data-url=" + value.urlParam + " data-id=" + value.id + " >" + value.name + "</a>";
                            }
                            $gradeItem.append(gradeLi);
                        });
                    }
                }
            });
        }
        //同步课程
        var currentAjax = null;
        function tongbuFn(urlParam, userGrade, prvId) {
            urlParam = urlParam ? urlParam : '';
            if(currentAjax) {currentAjax.abort();}
            currentAjax = $.ajax({
                url: '/Index/liveCourseList',
                type: 'POST',
                data: {
                    indexPageUrl: urlParam,
                    courseType: '1',
                    xes_new_prv_id: prvId,
                    userGrade: userGrade
                },
                dataType: 'json',
                success: function (res) {
                    $noticeWarp.hide();
                    if (res.status === 1) {
                        $longLiveBox.children('li').remove();
                        var longLiveData = res.data.course;
                        longLiveDataLength = longLiveData.length;
                        if (longLiveDataLength === 0) {
                            $tongbuCourseBox.hide();
                        } else {
                            $tongbuCourseBox.show();
                            longLiveData.forEach(function (value, index, array) {
                                tbcourse[index] = {
                                    'siftid': value.courseId,
                                    'locationid': index
                                };
                                var longLiveItem = "<li class='course-list-item' data-xeslog-params='key=xeslog-courseIndex-www&action=click-look-liveCourseSelect&course_id=" + value.courseId + "&request_id=" + res.data.requestId + "&click_url=" + value.url + "&api_id=" + res.data.api_id + "&item_id=" + index + "&target_id=1.2.0&click_id=1.1.26&grade_id=" + userGrade + "&amp;subject_id=" + value.subjectName + "'>"
                                    + "<a href='" + value.url + "' class='xue-mall-course-link'></a>"
                                    + "<div class='free-card'>"
                                    + " <div class='free-card-top'>"
                                    + " <img src='" + value.subjectUrl + "'>"
                                    + "	<span class='free-label'>" + value.courseCount + "</span>"
                                    + "</div>"

                                    + " <div class='free-card-center'>"

                                    + " <p class='xue-card-title am-text-lg'>"
                                    + " <span class='am-badge am-badge-danger xue-badge-tag am-radius'>" + value.termName + "</span>&nbsp;"
                                    + "<span class='am-badge am-badge-danger xue-badge-tag am-radius xue-badge-border'>" + value.subjectName + "</span>"
                                    + " <span class='course-title' title='" + value.courseName + "'>" + value.courseName + "</span>"
                                    + "</p>"

                                    + " </div>"
                                    + "<div class='free-card-bottom'>"
                                    + "  <div class='free-card-detail free-card-num-detail-info'>"
                                    + " <p class='free-card-detail-num'>";
                                if(value.courseContent != ''){
                                    longLiveItem +=
                                        " <span class='courses-num'>" + value.courseContent + "</span>"
                                }
                                longLiveItem += value.buyNum + ""
                                    + " </p>"
                                    + " </div>"
                                    + "<span class='am-text-danger free-card-price-info'><strong class='xue-course-price'>¥" + value.resale + "</strong>起</span>"
                                    + "</div>"
                                    + "</div>"

                                    + "</li>";
                                $longLiveBox.append(longLiveItem);
                            });
                        }
                    } else {
                        $tongbuCourseBox.hide();
                        longLiveDataLength = 0;
                    }
                    zhuantiFn(urlParam, userGrade, prvId, longLiveDataLength);
                }
            });
        }
        //专题课程
        function zhuantiFn(urlParam, userGrade, prvId, length) {
            urlParam = urlParam ? urlParam : '';
            $.ajax({
                url: '/Index/liveCourseList',
                type: 'POST',
                data: {
                    indexPageUrl: urlParam,
                    courseType: '2',
                    xes_new_prv_id: prvId,
                    userGrade: userGrade
                },
                dataType: 'json',
                success: function (res) {
                    if (res.status === 1) {
                        $liveCourseBox.children('li').remove();
                        var liveCourseData = res.data.course;
                        $more.attr('href', res.data.themeMore)
                        if (liveCourseData.length === 0 && length == 0) {
                            $noticeWarp.show();
                        }
                        if (liveCourseData.length === 0) {
                            $zhuantiCourseBox.hide();
                        } else {
                            $noticeWarp.hide();
                            $zhuantiCourseBox.show();
                            liveCourseData.forEach(function (value, index, array) {
                                var teaHeadImgUrls = value.teaHeadImgUrls;
                                var teaHeadImgLi = '';
                                var teaHeadImgInfo = '';
                                if (teaHeadImgUrls.length > 0) {
                                    teaHeadImgUrls.forEach(function (value, index, array) {
                                        teaHeadImgLi += "<span><img src='" + value + "'></span>";
                                    });
                                    teaHeadImgInfo = "<li>"
                                        + "<div class='xue-card-subject-avatar xue-avatar-style" + value.teaHeadImgUrls.length + "'>"
                                        + teaHeadImgLi
                                        + "</div>"
                                        + "<p class='xue-card-subject-teacher-name'>" + value.teacherAlias + "</p>"
                                        + "<p class='xue-card-subject-teacher-name'>" + value.teacherName + "</p>"
                                        + "</li>";
                                }
                                var foreignTeaHeadImgUrls = value.foreignTeaHeadImgUrls;
                                var foreignTeaHeadImgLi = '';
                                var foreignTeaHeadImgInfo = '';
                                if (foreignTeaHeadImgUrls.length > 0) {
                                    foreignTeaHeadImgUrls.forEach(function (value, index, array) {
                                        foreignTeaHeadImgLi += "<span><img src='" + value + "'></span>";
                                    });
                                    foreignTeaHeadImgInfo = "<li>"
                                        + "<div class='xue-card-subject-avatar xue-avatar-style" + value.foreignTeaHeadImgUrls.length + "'>"
                                        + foreignTeaHeadImgLi
                                        + "</div>"
                                        + "<p class='xue-card-subject-teacher-name'>" + value.foreignTeacherAlias + "</p>"
                                        + "<p class='xue-card-subject-teacher-name'>" + value.foreignTeacherName + "</p>"
                                        + "</li>";
                                }
                                var counselorHeadImgInfo = '';
                                if (value.counselorHeadImgUrl) {
                                    counselorHeadImgInfo = "<li>"
                                        + "<div class='xue-card-subject-avatar xue-avatar-style1'>"
                                        + "<span><img src='" + value.counselorHeadImgUrl + "'></span>"
                                        + "</div>"
                                        + "<label class='student-num-label'><span>" + "余" + value.classLimitNum + "名额" + "</span></label>"
                                        + "<p class='xue-card-subject-teacher-name'>辅导</p>"
                                        + "<p class='xue-card-subject-teacher-name'>" + value.counselorName + "</p>"
                                        + "</li>";
                                }
                                var priceBox;
                                if (value.isFull === 0) {
                                    if (value.resale < value.sprice) {
                                        var originPrice = "<span class='course-origin-price'>" + value.price + "</span>";
                                    } else {
                                        var originPrice = "<span class='course-origin-price'></span>";
                                    }
                                    priceBox = originPrice + "<span class='am-text-danger'>¥<strong class='am-text-xxl'>" + value.resale + "</strong></span>";
                                } else {
                                    priceBox = "<span class='am-text-soled'>已报满</span>"
                                }
                                if (value.studyTime != '') {
                                    var timebox = "<span class='xue-specialCourse-card-date'><i class='iconfont icon-lishi'></i>" + value.studyTime + "</span> "
                                } else {
                                    var timebox = '';
                                }
                                var liveCourseItem = "<li class='course-list-item' data-xeslog-params='key=xeslog-courseIndex-www&amp;action=click-look-liveCourseDetail&amp;course_id=" + value.courseId + "&amp;class_id=" + value.classId + "&amp;request_id=" + res.data.requestId + "&amp;click_url=" + value.url + "&amp;api_id=1.1.0&amp;item_id=" + index + "&amp;target_id=1.3.0&amp;click_id=1.1.27&amp;grade_id=" + userGrade + "&amp;subject_id=" + value.subjectName + "'>"
                                    + "<a href='" + value.url + "' class='xue-mall-course-link'></a>"
                                    + "<div class='xue-card xue-card-border xue-specialCourse-card-box'>"
                                    + "<div class='xue-card-body am-margin-sm'>"
                                    + "<p class='xue-card-title am-text-lg'>"
                                    + "<span class='am-badge am-badge-danger xue-badge-tag am-radius'>" + value.termName + "</span> "
                                    + "<span class='am-badge am-badge-danger xue-badge-tag am-radius xue-badge-border'>" + value.subjectName + "</span> "
                                    + "<span class=''>" + value.courseName + "</span>"
                                    + "</p>"
                                    + "<p class='xue-card-subhead xue-free-card-subhead am-text-sm am-margin-bottom-0'>"
                                    + timebox
                                    + "</p>"
                                    + "<ul class='xue-card-subject-teacher'>"
                                    + teaHeadImgInfo
                                    + foreignTeaHeadImgInfo
                                    + counselorHeadImgInfo
                                    + "</ul>"
                                    + "<hr data-am-widget='divider' style='' class='am-divider am-divider-default am-no-layout'>"
                                    + "<p class='am-margin-0 am-text-right'>"
                                    + "<span class='am-text-danger-sign'>"
                                    + "<b>" + value.deadTime + "</b>"
                                    + "</span>"
                                    + priceBox
                                    + "</p>"
                                    + "</div>"
                                    + "<div class='xue-card-footer'>"
                                    + "</div>"
                                    + "</div>"
                                    + "</li>";
                                $liveCourseBox.append(liveCourseItem);
                            });
                        }
                    } else {
                        if (length == 0) {
                            $noticeWarp.show();
                        }
                        $tongbuCourseBox.hide();
                    }
                }
            });
        }
        //头部信息
        var headerInfoFnAjax = null;
        function headerInfoFn(userGrade,userId) {
            userGrade = userGrade ? userGrade : '';
            if(headerInfoFnAjax){headerInfoFnAjax.abort();}
            var data={
                adslot_id:1,
                user_id:parseInt(userId),
                info:{
                    grade:parseInt(userGrade)
                }
            }

            headerInfoFnAjax = $.ajax({
                url: '//ads.xueersi.com/v1/search',
                type: 'post',
                dataType: 'json',
                data: JSON.stringify(data),
                success: function(res) {
                    if(res.code === 0){
                        $headerAdvBox.html("");
                        $headerAdvBox.append(res.data.adverts[0].content)

                        var Advert_info={
                            dnf:res.data.dnf,
                            extra:res.data.extra,
                            order:res.data.adverts[0].order,
                            ad_id:res.data.adverts[0].id,
                            material_id:parseInt(res.data.adverts[0].material_id),
                            grade_id:res.data.dnf.grade
                        }
                        var params = 'key=xeslog-CourseIndex-www&click_id=1.1.28&log_from=advert&device_id='+getCookie('ip')+'&client_type=pc&event_name=click&advert_info='+JSON.stringify(Advert_info).replace(/\s/g,"&nbsp;")
                        $headerAdvBox.find("a").attr("data-xeslog-params",params)
                        var _this = $headerAdvBox.find("a"),
                            _params = params.replace("event_name=click","event_name=exposure");
                        Log_params(_this,_params)
                    }
                },
                error: function(err) {

                }
            })

            $.ajax({
                url: '/Index/headerInfo',
                type: 'POST',
                data: {
                    userGrade: userGrade
                },
                dataType: 'json',
                success: function (res) {
                    if (res.status == 1) {
                        curGrade = res.data.student.cur_grade;
                        var headerAdvData = res.data.advert;
                        headeAdvert = headerAdvData.id;
                        $provinceName[0].innerHTML = res.data.province.name;
                        $provinceName.attr('data-id', res.data.province.id);
                        provinceId = res.data.province.id;
                        if (res.data.isLogin === 1) {
                            $noLoginShow.hide();
                            $loginShow.show();
                            var userInfo = "<a class='xue-mall-topbar-text' href='https://account.xueersi.com' data-xeslog-params='key=xeslog-headAndSidebar-www&click_url=https://account.xueersi.com&click_id=1.8.18&api_id=" + res.data.api_id + ">"
                                + "<span class='xue-mall-topbar-text'>" + res.data.student.showName
                                + "<i class='am-icon-angle-down xue-mall-dropdown-icon'></i>"
                                + "</span>"
                                + "</a>";
                            $loginShow.find('.xue-mall-topbar-text').remove();
                            $loginShow.prepend(userInfo);
                            // searchHistory();

                        } else {
                            $noLoginShow.show();
                            $loginShow.hide();
                        }
                    } else {
                        $noLoginShow.show();
                        $loginShow.hide();
                    }

                }
            });
        }
        //跟屏数据
        function sidebarInfoIn() {
            $.ajax({
                url: '/Index/sidebarInfo',
                type: 'POST',
                dataType: 'json',
                success: function (res) {
                    if (res.status === 1) {
                        var zhiManager = (getzhiSDKInstance());
                        zhiManager.on("load", function (ret) {
                            zhiManager.initBtnDOM();
                        });
                        //
                        zhiManager.set('title', '欢迎咨询');
                        zhiManager.set('location', 1);
                        //对接用户身份、预留字段、自定义字段
                        zhiManager.set('userinfo', {
                            partnerId: res.data.partnerId,
                        });
                        zhiManager.set('customBtn', 'true');
                        //开启浏览轨迹
                        zhiManager.set('manTrance', 'true');
                        //上一页信息
                        zhiManager.set('preVisitArgs', {
                            'preVisitUrl': res.data.preVisitArgs.preVisitUrl,
                        });
                        //当前页信息
                        zhiManager.set('curVisitArgs', {
                            'curAbstract': res.data.curVisitArgs.curAbstract,
                            'curVisitUrl': res.data.curVisitArgs.curVisitUrl,
                            'curVisitTitle': res.data.curVisitArgs.curVisitTitle
                        });
                        zhiManager.set('moduleType', 4);
                        zhiManager.set('powered', false);
                        zhiManager.set('groupId', 'bd70a2e0d94c4dd48cb2baa21c579204'); //客服组id
                        // time 显示历史聊天记录的时间范围，需传入分钟数，有效值10-2880（10分钟-48小时）
                        zhiManager.set('time', 2880);
                        window.collectLink = res.data.collectLink;
                    }
                }
            })
        }

        // 刷新页面时
        if (Number(getCookie('is_login')) === Number(1)) {
            // cookie - is_login的值等于1时为登录状态  需要传登录状态的值
            var _userGrade = getCookie('userGrade');//年级
            var _userId = getCookie('stu_id');//用户ID

        } else {
            // cookie - is_login的值等于0或cookie没有时时为未登录状态  需要传未登录状态的值
            var _userGrade = sessionStorage.getItem('grade') || '8';//有的话session or 8
            var _userId = '0';//用户ID
        }

        var _urlParam = sessionStorage.getItem('key') || 'chu1-0-0-0-0-0-0-0-100-0-0-0-0-1-1';//如果有session or chu1


        var _prvId = !getCookie('xes_new_prv_id') ? $('.province-name').data('id') : getCookie('xes_new_prv_id');//地区var prvId = $('.province-name').data('id');
        headerInfoFn(_userGrade,_userId);
        hotWordsFn();
        carouseFn(_userGrade,_userId);
        footAdFn(_userGrade,_userId);
        tabAjax(_urlParam, _userGrade, _prvId);//tab类筛选
        tongbuFn(_urlParam, _userGrade, _prvId);
        sidebarInfoIn();
        // 点击切换年级
        $xueMallCourseList.on('click', 'a', function () {
            var urlParam = $(this).data('url');
            var userGrade = $(this).data('id');
            var dataId = $('.province-name').data('id');
            var cookId = getCookie('xes_new_prv_id');
            var prvId = !cookId ? dataId : cookId;
            if ($(this).hasClass('active') != true) {
                sessionStorage.setItem('key', urlParam);
                sessionStorage.setItem('grade', userGrade);
                setCookie('userGrade', userGrade);
                tabAjax(urlParam, userGrade, prvId);//tab类筛选
                tongbuFn(urlParam, userGrade, prvId);
                if (Number(getCookie('is_login')) === Number(1)) {
                    var _userId = getCookie('stu_id');//用户ID
                } else {
                    var _userId = '0';//用户ID
                }
                headerInfoFn(userGrade,_userId);//头部信息
                footAdFn(userGrade,_userId);
                carouseFn(userGrade,_userId);//轮播图
            }


        });

        setTimeout(function () {
            var leId = $('.province-name').attr('data-id');
            $('.xue-mall-triangle-left li[data-id="' + leId + '"]').addClass('active').siblings().removeClass('active');
        }, 3000)
        window.courseDatanSerach = "pageuid=1.1.0&log_from=advert";

    });
</script>
<script src="{{ asset('js/amazeui.min.js') }}" charset="utf-8">
</script>
<script src="{{ asset('js/bootstrap.min.js') }}"></script>
<script type="{{ asset('js/xue.mall.min.js') }}"></script>
<script type="text/javascript">
    $(function () {
        var carouselInterval = '';
        $('body').on('mouseover', '.focus-num-wrap li', function () {
            if (carouselInterval) {
                clearTimeout(carouselInterval);
            }
            var _t = this;
            //获取当前滑过元素的索引值
            carouselInterval = setTimeout(function () {
                var index = parseFloat($(_t).data('slide-to'));
                $("#xue-mall-banner-box").carousel(index);
            }, 400);
        }).on('mouseout', '.focus-num-wrap li', function () {
            clearTimeout(carouselInterval);
        });
        // banner广告遮罩3秒消失并存储cookie记录状态
        setTimeout(function () {
            $('.xue-mall-banner-mask').fadeOut();
            // 存储cookie值xes_mask_type为0
            xueMall.fn.bannerMaskType();
        }, 10000)


    });
</script>
</body>
</html>

